package il.ac.bgu.cs.heuristics.core;


import java.util.Calendar;

public class Statistic implements IStatistic {

	private long	startTime;
	private long	endTime;
	private long	counter;
	private boolean	bStartTime;
	private boolean	bEndTime;

	public Statistic() {
		startTime = 0;
		endTime = 0;
		counter = 0;
		bEndTime = false;
		bStartTime = false;

	}

	public long getCounter() {
		return counter;
	}

	public long getTimeTotal() {
		if (bStartTime & bEndTime)
			return startTime - endTime;
		else
			return -1;
	}

	public long incrementCounter() {
		counter++;
		return counter;
	}

	public void start() {
		startTime = Calendar.getInstance().getTimeInMillis();
		bStartTime = true;
	}

	public void stop() {
		endTime = Calendar.getInstance().getTimeInMillis();
		bEndTime = true;
	}

}
